package cn.qayy.service.impl;

import java.util.List;
import java.util.Map;
import java.util.logging.Logger;

import javax.annotation.Resource;

import org.apache.log4j.spi.LoggerFactory;
import org.springframework.stereotype.Service;
import org.springframework.web.bind.annotation.RequestParam;

import com.github.pagehelper.PageHelper;
import com.github.pagehelper.PageInfo;

import cn.qayy.dao.BasisMapper;
import cn.qayy.dao.GoodFriendMapper;
import cn.qayy.dto.BasisDTO;
import cn.qayy.dto.GFDTO;
import cn.qayy.po.Basis;
import cn.qayy.po.KdbNssGoodfriend;
import cn.qayy.service.IGoodFriendService;
import cn.qayy.utils.DownLoadUtil;

/***
 * @author wy
 *
 */
@SuppressWarnings("all")
@Service("goodFriendServiceImpl")
public class GoodFriendServiceImpl implements IGoodFriendService {

	@Resource
	public GoodFriendMapper gfMapper;

	@Override
	public PageInfo<Map<String, Object>> selectGFBy(Map<String, Object> params) throws Exception {
		if (params != null && params.size() > 0) {
			DownLoadUtil.set("GFDTO",params);
			if (params.containsKey("pageNumber") && params.containsKey("pageSize")) {
				Integer pageNum = Integer
						.parseInt(params.get("pageNumber") == null ? "1" : params.get("pageNumber").toString());
				Integer pageSize = Integer
						.parseInt(params.get("pageSize") == null ? "12" : params.get("pageSize").toString());
				PageHelper.startPage(pageNum, pageSize);
			}
			List<Map<String, Object>> list = gfMapper.selectGFBy(params);
			
			PageInfo<Map<String, Object>> pageInfo = new PageInfo<Map<String, Object>>(list);
			return pageInfo;
		}
		return null;
	}

	
	@Override
	public int insertByList(List list) throws Exception {
		return gfMapper.insertByList(list);
	}

	@Override
	public int updateByList(List list) throws Exception {
		return gfMapper.updateByList(list);
	}

	@Override
	public int deleteByList(List list) throws Exception {
		// TODO Auto-generated method stub
		return 0;
	}

	@Override
	public int insert(Object bean) throws Exception {
		// TODO Auto-generated method stub
		return 0;
	}

	@Override
	public int update(Object bean) throws Exception {
		// TODO Auto-generated method stub
		return 0;
	}

	@Override
	public int delete(Object bean) throws Exception {
		// TODO Auto-generated method stub
		return 0;
	}

	@Override
	public List<GFDTO> selectGFForDown(Map<String, Object> params) throws Exception {
		// TODO Auto-generated method stub
		return null;
	}

	@Override
	public KdbNssGoodfriend selectGFByID(Integer gfId) throws Exception {
		return gfMapper.selectByPrimaryKey(gfId);
	}


	@Override
	public List<KdbNssGoodfriend> selectByMap(Map<String, Object> params) {
		return gfMapper.selectByMap(params);
	}


	@Override
	public List<Integer> selectIdsByMap(Map<String, Object> params) {
		return gfMapper.selectIdsByMap(params);
	}
}
